import { FormSchema } from '/@/components/Table';
import { isRoleExist } from './role.api';
export const columns = [
  {
    title: '场地名称',
    dataIndex: 'spaceName',
    width: 80,
  },
  {
    title: '场地面积',
    dataIndex: 'spaceArea',
    width: 150,
  },
  {
    title: '所在位置',
    dataIndex: 'pidNames',
    width: 150,
  },
  {
    title: '使用状态',
    dataIndex: 'status',
    width: 90,
    customRender: function ({ text }) {
      if (text == 1) {
        return '闲置';
      } else if (text === 2) {
        return '在用';
      } else if (text === 3) {
        return '维修中';
      } else if (text === 4) {
        return '废弃';
      }
    },
  },
  {
    title: '场地描述',
    dataIndex: 'spaceDescr',
    width: 150,
  },
];
/**
 * 角色用户Columns
 */
export const userColumns = [
  {
    title: '开始时间',
    dataIndex: 'startTime',
  },
  {
    title: '结束时间',
    dataIndex: 'endTime',
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 90,
    customRender: function ({ text }) {
      if (text == 1) {
        return '已预约';
      } else if (text == 2) {
        return '已撤销';
      } else if (text == 3) {
        return '已受理';
      } else if (text == 4) {
        return '已结束';
      }
    },
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'spaceName',
    label: '场地名称',
    component: 'Input',
    colProps: { span: 6 },
  },
];
/**
 * 角色用户搜索form
 */
export const searchUserFormSchema: FormSchema[] = [
  {
    field: 'sendTime',
    label: '预约时间',
    component: 'RangeDate',
    componentProps: {
      valueType: 'Date',
    },
    colProps: { span: 6 },
  },
  // {
  //   field: 'username',
  //   label: '用户账号',
  //   component: 'Input',
  //   colProps: { span: 12 },
  //   labelWidth: 74,
  // },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      options: [
        {
          label: '闲置',
          value: 1,
          key: 1,
        },
        {
          label: '维修中',
          value: 3,
          key: 3,
        },
        {
          label: '废弃',
          value: 4,
          key: 4,
        },
      ],
    },
    required: true,
  },
];

export const formDescSchema = [
  {
    field: 'roleName',
    label: '角色名称',
  },
  {
    field: 'roleCode',
    label: '角色编码',
  },
  {
    label: '备注',
    field: 'description',
  },
];

export const roleIndexFormSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    label: '角色编码',
    field: 'roleCode',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    label: '首页路由',
    field: 'url',
    component: 'Input',
    required: true,
    helpMessage: '首页路由的访问地址',
  },
  {
    label: '组件地址',
    field: 'component',
    component: 'Input',
    helpMessage: '首页路由的组件地址',
    componentProps: {
      placeholder: '请输入前端组件',
    },
    required: true,
  },
  {
    field: 'route',
    label: '是否路由菜单',
    helpMessage: '非路由菜单设置成首页，需开启',
    component: 'Switch',
    defaultValue: true,
  },
  {
    label: '优先级',
    field: 'priority',
    component: 'InputNumber',
  },
  {
    label: '是否开启',
    field: 'status',
    component: 'JSwitch',
    componentProps: {
      options: ['1', '0'],
    },
  },
];
